﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ERPStore.Extensions;

using CloudSoft.Extensions;

namespace ERPStore.NewsLetters.Services
{
	public class AllContactRecipientSourceProvider : UserRecipientSourceProviderBase
	{
		public AllContactRecipientSourceProvider(
			ERPStore.Services.IValidatorService validator
			, NewsLettersService newsLetterService
			, ERPStore.Logging.ILogger logger)
			: base(validator, newsLetterService, logger)
		{
		}

		#region IRecipientListProvider Members

		public override void Initialize(Models.EmailListSource source)
		{
			if (source == null)
			{
				throw new ArgumentException("source does not be null");
			}
			m_Filter = new ERPStore.Models.UserListFilter();
			m_Filter.HasEmail = true;
		}

		public override string SourceTypeId
		{
			get { return "00648954-D8A2-4EA6-988E-1614A103B2F88"; }
		}

		public override string DisplayName
		{
			get
			{
				return "Tous les clients (pro/particulier)";
			}
		}

		public override IList<ERPStore.Models.BrokenRule> Validate()
		{
			return new List<ERPStore.Models.BrokenRule>();
		}

		public override string GetSerializedSettings()
		{
			return m_Filter.SerializeToXml();
		}
		#endregion

	}
}
